package en.edu.zxj.mq.mqclient;

import lombok.Data;

import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 * Description：工厂类 -- 以工厂模式来创建 Connection 类
 *
 * @author: zxj
 * @date: 2024-03-06
 * @time: 21:55:32
 */
@Data
public class ConnectionFactory {
    // BrokerServer 的 IP 和 port
    private String host;
    private Integer port;

    // more ...

    // 建立一个 TCP 连接
    public Connection newConnection() throws IOException {
        Connection connection = new Connection(host,port);
        return connection;
    }
}
